package org.example.util;

import org.activiti.engine.RuntimeService;
import org.activiti.engine.runtime.ProcessInstance;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

@Component
public class FlowUtil {
    @Resource
    private RuntimeService runtimeService;

    /**
     * true结束 false没结束
     * @param id
     * @return
     */
    public Boolean processState(String id){
        ProcessInstance pi= runtimeService // 获取运行时Service
                .createProcessInstanceQuery() // 创建流程实例查询
                .processInstanceId(id) // 用流程实例id查询
                .singleResult();
        return pi == null?true:false;
    }
}
